const http = require('http');
const url = require('url');
const querystring = require('querystring');

http.createServer((req, res) => {
    console.log(`${req.method} ${req.url}`);

    const query = querystring.parse(url.parse(req.url).query);
    console.log('query:', query);
    console.log('headers:', req.headers);

    res.writeHead(200, { 'Content-Type': 'text/plain' });
    res.end('Hello World\n');
}).listen(1337, '127.0.0.1');

console.log('Server running at http://127.0.0.1:1337');
